

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Usergrid 2: Deploy to Tomcat &mdash; Apache Usergrid 2.x documentation</title>
  

  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  

  

  
    <link rel="top" title="Apache Usergrid 2.x documentation" href="../index.html"/> 

  
  <script src="../_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-nav-search">
        

        
          <a href="../index.html" class="icon icon-home"> Apache Usergrid
        

        
        </a>

        
          
          
            <div class="version">
              2.x
            </div>
          
        

        
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

        
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
        
          
          
              <p class="caption"><span class="caption-text">Getting Started</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../introduction/overview.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/usergrid-features.html">Usergrid Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/data-model.html">Usergrid Data model</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/async-vs-sync.html">Async vs. sync calls</a></li>
</ul>
<p class="caption"><span class="caption-text">Using Usergrid</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/creating-account.html">Creating a Usergrid Account</a></li>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/creating-a-new-application.html">Creating a new application</a></li>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/using-a-sandbox-app.html">Using a Sandbox Application</a></li>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/using-the-api.html">Using the API</a></li>
</ul>
<p class="caption"><span class="caption-text">Data Storage</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/data-store-dbms.html">The Usergrid Data Store</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/optimizing-access.html">Data Store Best Practices</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/collections.html">Collections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/entities.html">Entities</a></li>
</ul>
<p class="caption"><span class="caption-text">Data Queries</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/querying-your-data.html">Querying your data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/query-parameters.html">Query parameters &amp; clauses</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/operators-and-types.html">Query operators &amp; data types</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/advanced-query-usage.html">Advanced query usage</a></li>
</ul>
<p class="caption"><span class="caption-text">Entity Connections</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../entity-connections/connecting-entities.html">Connecting entities</a></li>
<li class="toctree-l1"><a class="reference internal" href="../entity-connections/retrieving-entities.html">Retrieving connections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../entity-connections/disconnecting-entities.html">Disconnecting entities</a></li>
</ul>
<p class="caption"><span class="caption-text">Push Notifications</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/overview.html">Push notifications overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/adding-push-support.html">Adding push notifications support</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/getting-started.html">Getting started with push notifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/tutorial.html">Tutorial: Push notifications sample app</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/registering.html">Registering with a notification service</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/creating-notifiers.html">Creating notifiers</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/managing-users-and-devices.html">Managing users and devices</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/creating-and-managing-notifications.html">Creating and managing notifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/troubleshooting.html">Troubleshooting</a></li>
</ul>
<p class="caption"><span class="caption-text">Security &amp; Authentication</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/app-security.html">Security &amp; token authentication</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-permissions.html">Using permissions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-roles.html">Using roles</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating users &amp; app clients</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/user-authentication-types.html">Authentication levels</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/changing-token-time-live-ttl.html">Changing token expiration (time-to-live)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-api-requests.html">Authenticating API requests</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/revoking-tokens-logout.html">Revoking tokens (logout)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/facebook-sign.html">Facebook sign in</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/securing-your-app.html">Security best practices</a></li>
</ul>
<p class="caption"><span class="caption-text">User Management &amp; Social Graph</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../user-management/user-management.html">User management &amp; social graph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/working-user-data.html">Working with User Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/group.html">Working with group data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/activity.html">Activity</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html">Social Graph Connections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html#creating-other-connections">Creating other connections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/messagee-example.html">App Example - Messagee</a></li>
</ul>
<p class="caption"><span class="caption-text">Geo-location</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../geolocation/geolocation.html">Geolocating your Entities</a></li>
</ul>
<p class="caption"><span class="caption-text">Assets &amp; Files</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../assets-and-files/uploading-assets.html">Uploading assets</a></li>
<li class="toctree-l1"><a class="reference internal" href="../assets-and-files/retrieving-assets.html">Retrieving assets</a></li>
<li class="toctree-l1"><a class="reference internal" href="../assets-and-files/folders.html">Folders</a></li>
</ul>
<p class="caption"><span class="caption-text">Counters &amp; Events</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/events-and-counters.html">Counters &amp; events</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html">Creating &amp; incrementing counters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#decrementing-resetting-counters">Decrementing/resetting counters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#using-counters-hierarchically">Using counters hierarchically</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/retrieving-counters.html">Retrieving counters</a></li>
</ul>
<p class="caption"><span class="caption-text">Organizations &amp; Applications</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/managing.html">Organization &amp; application management</a></li>
<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/organization.html">Organization</a></li>
<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/application.html">Application</a></li>
<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/admin-user.html">Admin user</a></li>
</ul>
<p class="caption"><span class="caption-text">API Reference</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html">Methods</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#models">Models</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#sub-types">Sub-Types</a></li>
</ul>
<p class="caption"><span class="caption-text">Client SDKs</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../sdks/tbd.html">COMING SOON...</a></li>
</ul>
<p class="caption"><span class="caption-text">Installing Usergrid</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="deployment-guide.html">Usergrid 2.1.0 Deployment Guide</a></li>
</ul>
<p class="caption"><span class="caption-text">More about Usergrid</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../reference/presos-and-videos.html">Presentations &amp; Videos</a></li>
<li class="toctree-l1"><a class="reference internal" href="../reference/contribute-code.html">How to Contribute Code &amp; Docs</a></li>
</ul>

          
        
      </div>
      &nbsp;
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="../index.html">Apache Usergrid</a>
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="../index.html">Docs</a> &raquo;</li>
      
    <li>Usergrid 2: Deploy to Tomcat</li>
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../_sources/installation/ug2-deploy-to-tomcat.txt" rel="nofollow"> View page source</a>
          
        
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="usergrid-2-deploy-to-tomcat">
<h1>Usergrid 2: Deploy to Tomcat<a class="headerlink" href="#usergrid-2-deploy-to-tomcat" title="Permalink to this headline">¶</a></h1>
<p><strong>NOTE</strong>: Beware that Usergrid 2 is UNRELEASED SOFTWARE</p>
<div class="section" id="requirements">
<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><a class="reference external" href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK
1.8</a></li>
<li><a class="reference external" href="http://maven.apache.org/">Maven 3.2+</a></li>
<li><a class="reference external" href="https://tomcat.apache.org/download-70.cgi">Tomcat 7+</a></li>
<li><a class="reference external" href="http://cassandra.apache.org/download/">Cassandra 1.2.1*</a></li>
<li><a class="reference external" href="https://www.elastic.co/downloads/elasticsearch">ElasticSearch
1.4+</a></li>
<li><a class="reference external" href="https://github.com/apache/usergrid/tree/2.1-release">Usergrid
2.1</a></li>
</ul>
</div>
<div class="section" id="running">
<h2>Running<a class="headerlink" href="#running" title="Permalink to this headline">¶</a></h2>
<ol class="arabic simple">
<li>Start up Cassandra  <a class="footnote-reference" href="#id2" id="id1">[1]</a><ol class="loweralpha">
<li>To do this you can navigate to the cassandra folder and run
<code class="docutils literal"><span class="pre">./bin/cassandra</span></code></li>
</ol>
</li>
<li>Start up Elasticsearch<ol class="loweralpha">
<li>To do this you can navigate to the folder where you extracted
elasticsearch and run <code class="docutils literal"><span class="pre">/bin/elasticsearch</span></code></li>
</ol>
</li>
</ol>
<div class="section" id="running-usergrid">
<h3>Running Usergrid<a class="headerlink" href="#running-usergrid" title="Permalink to this headline">¶</a></h3>
<div class="section" id="build-the-java-sdk">
<h4>Build The Java SDK<a class="headerlink" href="#build-the-java-sdk" title="Permalink to this headline">¶</a></h4>
<ol class="arabic simple">
<li>Navigate to where you cloned the usergrid repo</li>
<li>Navigate to the <code class="docutils literal"><span class="pre">sdks/java</span></code> directory</li>
<li>Run <code class="docutils literal"><span class="pre">mvn</span> <span class="pre">clean</span> <span class="pre">install</span></code></li>
</ol>
</div>
<div class="section" id="build-the-stack-itself">
<h4>Build The Stack Itself<a class="headerlink" href="#build-the-stack-itself" title="Permalink to this headline">¶</a></h4>
<ol class="arabic simple">
<li>Navigate to the <code class="docutils literal"><span class="pre">stack</span></code> directory.</li>
<li>Run <code class="docutils literal"><span class="pre">mvn</span> <span class="pre">clean</span> <span class="pre">install</span> <span class="pre">-DskipTests</span></code></li>
<li>This will generate a war at <code class="docutils literal"><span class="pre">rest/target/ROOT.war</span></code></li>
</ol>
</div>
<div class="section" id="deploying-the-stack-locally">
<h4>Deploying the Stack Locally<a class="headerlink" href="#deploying-the-stack-locally" title="Permalink to this headline">¶</a></h4>
<ol class="arabic simple">
<li>Take this war and deploy it on downloaded tomcat.</li>
<li>In the lib directory of the tomcat you must also put
usergrid-deployment.properties. ( An example file is provided below)</li>
<li>Start up Tomcat<ol class="loweralpha">
<li>To do this you can navigate to folder where Tomcat is install and
run <code class="docutils literal"><span class="pre">./bin/catalina.sh</span> <span class="pre">start</span></code></li>
</ol>
</li>
</ol>
<p>Next, you need to make some API calls to initialize Usergrid&#8217;s storage
and indexing systems. You can make these API calls using curl or your
favorite HTTP client. These calls can only be done with the superuser
credentials that appear in your <strong>usergrid-deployment.properties</strong> file.
Here&#8217;s how to do the calls with curl (and assuming your superuser
password is &#8216;test&#8217;):</p>
<div class="highlight-python"><div class="highlight"><pre>curl -X PUT http://localhost:8080/system/database/setup -u superuser:test
curl -X PUT http://localhost:8080/system/database/bootstrap -u superuser:test
curl -X GET http://localhost:8080/system/superuser/setup -u superuser:test
</pre></div>
</div>
<p>Once those three calls execute without error, then you are done. If you
do see errors the double-check that you have Cassandra and ElasticSearch
running and that your properties files lists your Cassandra and
ElasticSearch hostnames correctly. Also check that ElasticSearch cluster
name (in elasticsearch.yml) matches the one in the Usergrid properties
file. If the problem persists come talk to us on the Usergrid mailing
list, we might be able to help.</p>
<p>The stack is now ready to be queried against, but to get the most out of
it you&#8217;ll need to initialize and use our portal!</p>
</div>
<div class="section" id="running-the-portal-locally">
<h4>Running The Portal Locally<a class="headerlink" href="#running-the-portal-locally" title="Permalink to this headline">¶</a></h4>
<div class="section" id="requirments">
<h5>Requirments<a class="headerlink" href="#requirments" title="Permalink to this headline">¶</a></h5>
<p><a class="reference external" href="https://nodejs.org/download/">nodejs 0.10+</a></p>
<ol class="arabic simple">
<li>Make sure you&#8217;ve installed node.js above. Any version above .10 or
.10 should work fine.</li>
<li>Navigate to <code class="docutils literal"><span class="pre">usergrid/portal</span></code>.</li>
<li>Open config.js and make sure the override URL is pointing to your
local tomcat.</li>
<li>Now in the portal folder run the following command <code class="docutils literal"><span class="pre">./build.sh</span> <span class="pre">dev</span></code></li>
<li>The portal should automatically open ready for use!</li>
</ol>
<p>Now usergrid is fully ready to use! Feel free to query against it or use
it however you like!</p>
</div>
</div>
</div>
</div>
<div class="section" id="example-usergrid-deployment-properties-file">
<h2>Example <strong>usergrid-deployment.properties</strong> file<a class="headerlink" href="#example-usergrid-deployment-properties-file" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre># core persistence properties

usergrid.cluster_name property=usergrid

cassandra.embedded=false
cassandra.version=1.2.18
cassandra.timeout=2000

collections.keyspace=Usergrid_Applications
collections.keyspace.strategy.options=replication_factor:1
collections.keyspace.strategy.class=org.apache.cassandra.locator.SimpleStrategy

collection.stage.transient.timeout=60

hystrix.threadpool.graph_user.coreSize=40
hystrix.threadpool.graph_async.coreSize=40

elasticsearch.embedded=false
elasticsearch.cluster_name=elasticsearch
elasticsearch.index_prefix=usergrid
elasticsearch.hosts=127.0.0.1
elasticsearch.port=9300

elasticsearch.force_refresh=true

index.query.limit.default=100

# Max Cassandra connections, applies to both CP and EM
cassandra.connections=600

######################################################
# Minimal Usergrid configuration properties for local Tomcat and Cassandra
#

cassandra.url=127.0.0.1:9160

cassandra.keyspace.strategy=org.apache.cassandra.locator.SimpleStrategy
cassandra.keyspace.strategy.options.replication_factor=1

######################################################
# Custom mail transport

mail.transport.protocol=smtps
mail.smtps.host=smtp.gmail.com
mail.smtps.port=465
mail.smtps.auth=true
mail.smtps.username=
mail.smtps.password=
mail.smtps.quitwait=false


######################################################
# Admin and test user setup

usergrid.sysadmin.login.name=superuser
usergrid.sysadmin.login.email=myself@example.com     &lt;--- Change this
usergrid.sysadmin.login.password=pwHERE               &lt;--- Change this
usergrid.sysadmin.login.allowed=true
usergrid.sysadmin.email=myself@example.com           &lt;--- Change this

usergrid.sysadmin.approve.users=false
usergrid.sysadmin.approve.organizations=false

# Base mailer account - default for all outgoing messages
usergrid.management.mailer=User &lt;myself@example.com&gt;    &lt;--- Change this

usergrid.setup-test-account=true

usergrid.test-account.app=test-app
usergrid.test-account.organization=test-organization
usergrid.test-account.admin-user.username=test
usergrid.test-account.admin-user.name=Test User
usergrid.test-account.admin-user.email=myself@example.com    &lt;---Change this
usergrid.test-account.admin-user.password=test

######################################################
# Auto-confirm and sign-up notifications settings

usergrid.management.admin_users_require_confirmation=false
usergrid.management.admin_users_require_activation=false

usergrid.management.organizations_require_activation=false
usergrid.management.notify_sysadmin_of_new_organizations=true
usergrid.management.notify_sysadmin_of_new_admin_users=true
######################################################
# URLs

# Redirect path when request come in for TLD
usergrid.redirect_root=http://localhost:8080/status

usergrid.view.management.organizations.organization.activate=http://localhost:8080/accounts/welcome
usergrid.view.management.organizations.organization.confirm=http://localhost:8080/accounts/welcome
usergrid.view.management.users.user.activate=http://localhost:8080/accounts/welcome
usergrid.view.management.users.user.confirm=http://localhost:8080/accounts/welcome

usergrid.organization.activation.url=http://localhost:8080/management/organizations/%s/activate
usergrid.admin.activation.url=http://localhost:8080/management/users/%s/activate
usergrid.admin.resetpw.url=http://localhost:8080/management/users/%s/resetpw
usergrid.admin.confirmation.url=http://localhost:8080/management/users/%s/confirm
usergrid.user.activation.url=http://localhost:8080%s/%s/users/%s/activate
usergrid.user.confirmation.url=http://localhost:8080/%s/%s/users/%s/confirm
usergrid.user.resetpw.url=http://localhost:8080/%s/%s/users/%s/resetpw
</pre></div>
</div>
<table class="docutils footnote" frame="void" id="id2" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>You can start up cassandra and elasticsearch in any order but for the
sake of ordered lists I put Cassandra first.</td></tr>
</tbody>
</table>
</div>
</div>


           </div>
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2013-2015, Apache Usergrid.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'../',
            VERSION:'2.x',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true
        };
    </script>
      <script type="text/javascript" src="../_static/jquery.js"></script>
      <script type="text/javascript" src="../_static/underscore.js"></script>
      <script type="text/javascript" src="../_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="../_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>